﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddMovieUserControl.ascx.cs" Inherits="MBS.UserControls.MovieUserControl.AddMovieUserControl" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>

<script type="text/javascript" src="jquery-1.4.1.js"></script>
<script type="text/javascript">

    $(document).ready(function () {
        $('[id$=txtDuration]').change(function () {
            if (!$(this).val().match(/^[0-9]+$/)) {
                $(this).val('0');
            }
        });

        $('[id$=txtRating]').change(function () {
            if (!$(this).val().match(/^-{0,1}\d*\.{0,1}\d+$/)) {
                $(this).val('0.0');
            }
        });
    });
    
    </script> 

<style type="text/css">
    .style1
    {
        width: 100%;
    }
   
</style>
<table class="style1">
    <tr>
        <td width="20%">
            <asp:Label ID="Label1" runat="server" Text="Movie Title" CssClass="label"></asp:Label>
        </td>
        <td width ="80%">
            <asp:TextBox ID="txtMovieTitle" runat="server"  ontextchanged="TextBox1_TextChanged" CssClass="textbox"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                ControlToValidate="txtMovieTitle" ErrorMessage="Enter Movie Title" ForeColor="Red" Text="*"></asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td >
             <asp:Label ID="Label2" runat="server" Text="Description" CssClass="label"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="txtDescription" runat="server" CssClass="textbox"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                ControlToValidate="txtDescription" ErrorMessage="Enter Description"  ForeColor="Red" Text="*"></asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td>
             <asp:Label ID="Label3" runat="server" Text="Duration (mins)" CssClass="label"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="txtDuration" runat="server" CssClass="textbox">0</asp:TextBox>

            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" 
                ControlToValidate="txtDuration" ErrorMessage="Enter Duration"  ForeColor="Red" Text="*"></asp:RequiredFieldValidator>

        </td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label4" runat="server" Text="Genre" CssClass="label"></asp:Label>
        </td>
        <td>
            <asp:TextBox ID="txtGenre" runat="server" CssClass="textbox"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" 
                ControlToValidate="txtGenre" ErrorMessage="Enter Genre"  ForeColor="Red" Text="*"></asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td >
            <asp:Label ID="Label5" runat="server" Text="Cast" CssClass="label"></asp:Label>
        </td>
        <td>
         <asp:TextBox ID="txtCast" runat="server" CssClass="textbox"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" 
                ControlToValidate="txtCast" ErrorMessage="Enter Cast" ForeColor="Red" Text="*"></asp:RequiredFieldValidator>
        </td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label6" runat="server" Text="Rating" CssClass="label"></asp:Label>
        </td>
        <td>
             <asp:TextBox ID="txtRating" runat="server" CssClass="textbox">0.0</asp:TextBox>

             <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" 
                 ControlToValidate="txtRating" ErrorMessage="Enter Rating" ForeColor="Red" Text="*"></asp:RequiredFieldValidator>

        </td>
    </tr>
    <tr>
        <td >
         <asp:Label ID="Label7" runat="server" Text="ImageURL" CssClass="label"></asp:Label>
        </td>
        <td>
         <asp:TextBox ID="txtImageURL" runat="server" CssClass="textbox"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" 
                ControlToValidate="txtImageURL" ErrorMessage="Enter URL" ForeColor="Red" Text="*"></asp:RequiredFieldValidator>
          </td>
    </tr>
    <tr>
        <td >
        <asp:Label ID="Label8" runat="server" Text="Release Date" CssClass="label"></asp:Label>
           </td>
        <td>
            <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
            </asp:ToolkitScriptManager>
            <!--
         <asp:Calendar ID="releaseDateCalendar"  runat="server" 
                onselectionchanged="releaseDateCalendar_SelectionChanged"></asp:Calendar>
                -->
                <asp:CalendarExtender ID="releaseDateCalendarAjax" TargetControlID="ReleaseDateTextBox" runat="server" CssClass="custom-calendar">
                    </asp:CalendarExtender>
                    <asp:TextBox ID="ReleaseDateTextBox" runat="server"  ></asp:TextBox>
                   
            <asp:RequiredFieldValidator ID="RequiredFieldValidator8" runat="server" 
                ControlToValidate="ReleaseDateTextBox" ErrorMessage="Enter Release Date" ForeColor="Red" Text="*"></asp:RequiredFieldValidator>
                   
           </td>
    </tr>
    <tr>
        <td>
            <asp:Label ID="Label10" runat="server" Text="Trailer URL" CssClass="label"></asp:Label>
        </td>
        <td>
             <asp:TextBox ID="txtTrailerURL" runat="server" CssClass="textbox"></asp:TextBox>

             <asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" 
                 ControlToValidate="txtTrailerURL" ErrorMessage="Enter Trailer URL" ForeColor="Red" Text="*"></asp:RequiredFieldValidator>

        </td>
    </tr>
    <tr>
        <td >
       
            </td>
        <td>  <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
        Text="Add" CssClass="button"/>
         <asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Clear" 
                CssClass="button" CausesValidation="False"/>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:ValidationSummary ID="ValidationSummary1" runat="server" ForeColor="Red" />
               </td>
    </tr>
   
</table>